package io;

import javax.imageio.IIOException;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.FileVisitResult;

/**
 * @author IT枫斗者
 * @ClassName ReaderDemo02.java
 * @From www.javatiaozao.com
 * @Description TODO
 */
public class ReaderDemo02 {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("myStream/222.txt");

        //一次读取一个字节,int read():
//        int len;
//        while ((len = fr.read()) != -1){
//            System.out.println((char) len);
//        }
//        fr.close();
        //int read(char[] chs):一次读取一个字符数组
        char[] chs = new char[1024];
        int len;
        while ((len = fr.read(chs)) != -1){
            System.out.print(new String(chs,0,len ));
        }
        fr.close();

    }
}
